<?php 
if(!$t)exit("<script language='javascript'>alert('不要调皮的 直接访问模板哦(*￣︶￣)!');window.location.href='/';</script>"); 
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <link rel="stylesheet" href="../Template/default1/assets/css/bootstrap-reboot.min.css">
        <link rel="stylesheet" href="../Template/default1/assets/css/bootstrap-grid.css">
        <link rel="stylesheet" href="../Template/default1/assets/css/pc_qrcode.css">
        <script src="../Template/default1/assets/js/jquery/jquery.min.js"></script>
        <title>在线支付  - 网上支付 安全快速！</title>
        <style>
          body {
                width: 100%;
                height: 100vh;
                background: #f7f7f7;
             
            }
        </style>
        
        </head>
     <body style="background-image: url(../Template/default1/assets/img/login-bg-2.jpg);">
          <section class='section details__section section--first  section--last'>
                <div style="padding-bottom: 18px;padding-top: 15px;" class="container">
                    <div class="row ">
                        <div class="col-12">
                        <div style="text-align:center" class="mt-3">
                            <svg t="1610806307396" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6171" width="26" height="26"><path d="M1024 199.18v410.38c0 110-89.54 199.18-200 199.18H200c-110.46 0-200-89.18-200-199.18V199.18C0 89.17 89.54 0 200 0h624c110.46 0 200 89.17 200 199.18z m-553.95 317v46.72q0.9 19.32 12 28.75t30.9 9.43q40.14 0 41.95-38.18v-47.58l86.6 0.45q11.73-0.9 18.49-8.76t7.67-19.54a33.48 33.48 0 0 0-7.67-19.32q-6.77-8.09-18.49-9h-86.6v-27.4l86.15-0.45q11.73-0.9 18.72-9a33.26 33.26 0 0 0 7.89-19.76q-0.9-11.23-7.67-18.42t-18.49-8.09h-66.3l69.91-113.2q9-11.68 9-24.71a50.37 50.37 0 0 0-4.28-15.27 24.48 24.48 0 0 0-7.22-9 27.29 27.29 0 0 0-9.92-4.49 74.75 74.75 0 0 0-12.4-1.8 43.43 43.43 0 0 0-19.4 7.19 54.51 54.51 0 0 0-14 13.48l-75.34 125.83L443 229.18A65.48 65.48 0 0 0 429 215a36.39 36.39 0 0 0-19.4-7.41q-18.49 2.25-25.26 10.11t-9 20.44a36.94 36.94 0 0 0 3.61 18.19 67.53 67.53 0 0 0 8.57 13.7l60.44 106H383q-12.18 0.9-18.72 8.09t-7.89 18.42q1.35 11.68 7.89 19.32t18.72 8.56l87.05 0.45v28.3H383q-12.18 0.9-18.72 8.09t-7.89 18.42a43.81 43.81 0 0 0 7.89 20.44q6.54 9.21 18.72 10.11h87.05z" fill="#4375ff" p-id="6172"></path><path d="M264.96 903.6m60.2 0l373.67 0q60.2 0 60.2 60.2l0 0q0 60.2-60.2 60.2l-373.67 0q-60.2 0-60.2-60.2l0 0q0-60.2 60.2-60.2Z" fill="#4375ff" p-id="6173"></path></svg>
                                                           <img src="../Template/default1/assets/img/<?=$type?>.jpg" alt="" style="height:30px;">
                                                    </div>
                        </div>
                    </div>
                </div>
                <div class='container'>
                    <div class="row">
                        <div class="col-12">
                            <div class="order">
                        <span>商户订单号：<span id="copy_money"><?=$srow['trade_no']?></span></span> 
                    </div>
                    <div class="goods_name">
                        <span>商品名称：<?=$srow['name']?></span>              
                    </div>
                    <div class="price mt-2">
                        <span><?=$srow['price']?></span>
                        <span>元</span> 
                    </div>
                    <div id="qrcode">
                       
                        <img style="padding:8px;" id="qrcode_load" src="../Template/default1/assets/img/loading.gif" class="code" /> 
                        
                    </div>
                    <!--按钮-->
                    <a id="startApp"></a>
                    <?=$startApp?>
                    <div class="price mt-1">
                        <span style="color:red"></span>  
                         <span style="color:red">请付款<?=$price?>元,注意不能多付或少付<br>
                         </span>
                         <span id="divTime" style="color:red"></span>  
                         </div>
                         <div class="shanxinzha">
                              <span>请使用支付宝扫一扫</span>
                               <br> <br>
                               <span style="padding-top:10px;color:red;font-weight:700;"></span>
                               </div>
                        </div>
                    </div>
                </div>
            </section>
            <!-- 弹窗开始 -->
        <div class="web_notice" style="position: fixed;top: 0;left: 0;width: 100%;height: 100%;background: rgba(0,0,0,0.3);z-index: 99999;">
		<div style="position: fixed;top: 50%;left: 50%;width: 350px;background: #FFF;transform: translate(-50%, -50%);border-radius: 40px;padding: 50px 40px;">
		  <h3 style="font-weight: bold;text-align: center;font-size: 30px;">支付注意</h3>
        		<div style="font-size: 16px;margin-top: 26px;line-height: 30px;color: #999;">
        		<br>
        		<font color="purple"><b>请在支付时务必支付订单金额，多付或少付系统都无法识别，这将导致你的订单无法完成。
        		<br>
        		<br>
        		<font color="red">订单金额：<?=$srow['price']?>元【注意小数点】</font></b><font color="red">
        		<br>
        		</font>
        		</font>
        		</div>
    		<font color="purple">
            		<a style="display: block;background: #98a3ff;color: #FFF;text-align: center;font-weight: bold;font-size: 19px;line-height: 60px;margin: 0 auto;margin-top: 45px;border-radius: 32px;width: 80%;" onclick="javascript:document.querySelector('.web_notice').remove()">懂了</a>
            		</font>
        		</div>
    		</div>
		
		<audio autoplay=""><source src="<?php echo $mp3;?>"></audio>
		<script src="<?php echo LayerJS?>"></script>
<script type="text/javascript">

    const serverTime = <?= time() ?>;
    const expireTime = <?= $srow['outtime'] ?>;
    let timeLeft = expireTime - serverTime;
    
    function formatTime(time) {
        return time < 10 ? '0' + time : time;
    }
    function updateTimer() {
        if (timeLeft <= 0) {
            // 订单过期
            $("#divTime").html("<small style='color:red; font-size:26px'>订单二维码已过期</small>");
            $("#qrcode").html('<img id="qrcode_load" src="../Template/default1/assets/img/qrcode_timeout.png">');
            clearInterval(timerInterval);
            return;
        }
    
        // 计算分钟和秒数
        const minutes = Math.floor(timeLeft / 60);
        const seconds = timeLeft % 60;
    
        // 更新显示
        $("#divTime").html(
            `二维码有效时间:<small style='color:red; font-size:26px'>${formatTime(minutes)}</small>分` +
            `<small style='color:red; font-size:26px'>${formatTime(seconds)}</small>秒,失效勿付`
        );
    
        timeLeft--;
    }
    updateTimer();
    // 设置定时器
    const timerInterval = setInterval(updateTimer, 1000);

    
	order();
	updateQrOk = 0;
	updateQrImg= 0;
	updateQrNo = 0;
     //订单监控  {订单监控}
	function order(){
        $.get("../Mcode_get/<?php echo $srow['trade_no']?>",{},function(result){
     		//支付二维码
     		if(result.code == '100' && updateQrImg==0){
 				updateQrImg = 1;
				var pay_type = '<?=$srow['type']?>';//支付方式
				var is_money = <?=$srow['money']?>;
				$('#price').html('¥'+result.data.money+'<font color=red style="font-size:8px">(不可多付或少付)</font>');//输出真实付款金额
				$("#qrcode").html('<img id="qrcode_load" height="180px" src="'+ result.data.qrcode +'">');//输出二维码图片
				
				if(pay_type == "alipay"){
				    
	               if(!isMobilCheck())
                      {

						$("#startApp").html('<a type="button" href="<?=$alipayh5url_4?>" class="header__order mt-2 zfbbtn" style="font-size:15px" target="_blank">点击跳转支付宝</a>');//H5按钮2
						window.location.href="<?=$alipayh5url_4?>";
						
					}
				}
		    }else if(result.code == '200' && updateQrOk==0){
		        	updateQrOk==1;
		        	$("#divTime").html("<small style='color:red; font-size:22px'>"+ result.msg +"</small>");
		        	$("#qrcode").html('<img id="qrcode_load" src="../Template/default1/assets/img/pay_ok.png">');//输出支付成功提示图片
		        		window.clearInterval(orderlst);
        				layer.msg('支付成功，正在跳转中...');
        				window.location.href=result.data.backurl;
		     }else if(result.code == '0' && updateQrNo==0){
		          updateQrNo==1;
               		$("#divTime").html("<small style='color:red; font-size:22px'>"+ result.msg +"</small>");
               			window.clearInterval(orderlst);
             			layer.confirm(result.msg, {
             			  icon: 2,
             			  title: '支付失败',
           				  btn: ['确认'] //按钮
           				}, function(){
        					location.href="/";
           				});
		           }
        },"JSON");
    }
	 function isMobilCheck() {
    	var userAgentInfo = navigator.userAgent;
    	var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");
    	var flag = true;
    	for (var v = 0; v < Agents.length; v++) {
    		if (userAgentInfo.indexOf(Agents[v]) > 0) {
    			flag = false;
    			break;
    		}
    	}
    	return flag;
    }
     
	//周期监听 
	orderlst = window.setInterval(function () {
		order();
	}, 1500); 
	</script>
	</body>
</html>